package cn.guxinhu.billsystem.user.service.impl;

import cn.guxinhu.billsystem.user.mapper.IUserMapper;
import cn.guxinhu.billsystem.user.pojo.BillUser;
import cn.guxinhu.billsystem.user.service.IUserRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Guxinhu
 * @create 2021-06-21 15:10
 */
@Service
public class UserRegisterServiceImpl implements IUserRegisterService {
    /**
     * @Description: 注册的Servier层
     * @Method: IncreaseServier.register()
     * @Param: iMapper(IMapper) -- mybatis(sql)映射接口
     * user(User) -- 前端传入的实体类
     * @Return:
     * @Author: Guxinhu
     * @Date Created in 2020/08/19 11:37
     */
    @Autowired

    private IUserMapper userMapper;

    public void register(BillUser user) {
        if (user.getUserName().equals("")) {
            user.setUserName(null);
        } else if (user.getPassWord().equals("")) {
            user.setPassWord(null);
        } else {
            user.setUserName(user.getUserName().trim());
            user.setPassWord(user.getPassWord().trim());
        }
        userMapper.register(user);
    }
}
